#include <iostream>
#include <unordered_map>
#include <vector>

using namespace std;

class Solution {
public:
    int majorityElement(vector<int>& nums) {
        unordered_map<int, int> hash;
        for (auto& e : nums) {
            ++hash[e];
        }

        int n = nums.size();
        for (auto& [x, y] : hash) {
            if (y > n / 2) {
                return x;
            }
        }
        return -1;
    }
};

int main()
{
    return 0;
}